package com.xxx.nio.selector;


import lombok.extern.slf4j.Slf4j;

import java.io.IOException;
import java.net.InetSocketAddress;
import java.nio.channels.SocketChannel;

/**
 * Selector Client端
 */
@Slf4j
public class Client {

    public static void main(String[] args) throws IOException {
        // 1.创建客户端的SocketChannel
        SocketChannel socketChannel = SocketChannel.open();
        // 2.连接到Socket Server
        socketChannel.connect(new InetSocketAddress("localhost", 8080));
        log.info("waiting for connecting...");
        socketChannel.close();  // 正常断开
        log.info("Socket Channel closed");
    }
}
